local sk__yanzhu = fk.CreateSkill {

  name = "sk__yanzhu",

  tags = {},

}



sk__yanzhu:addEffect("active", {
  name = "sk__yanzhu",
  anim_type = "control",
  card_num = 0,
  target_num = 1,
  prompt = "#sk__yanzhu",
  can_use = function(self, player)
    return player:usedSkillTimes(sk__yanzhu.name, Player.HistoryPhase) < 3
  end,
  card_filter = Util.FalseFunc,
  target_filter =function (self, player, to_select, selected, selected_cards)
    return #selected == 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:addPlayerMark(target, "@sk__yanzhu", 1)
    local n = #table.filter(room.alive_players, function(p)
      return p:getMark("@sk__yanzhu") == target:getMark("@sk__yanzhu")
    end)
    if target:getMark("@sk__yanzhu") == 1 then
      target:drawCards(n, sk__yanzhu.name)
    elseif target:getMark("@sk__yanzhu") == 2 then
      room:askForDiscard(target, n, n, true, sk__yanzhu.name, false)
    elseif target:getMark("@sk__yanzhu") == 3 then
      room:damage({
        from = player,
        to = target,
        damage = n,
        skillName = sk__yanzhu.name,
      })
    end
  end,
})

return sk__yanzhu
